<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>

    <c:set var="geoconten" value="${sessionScope[param.id_frawor]}" scope="page"></c:set>

    <c:if test="${param.filtrar != null && param.filtrar != '' && param.filtrar == 'true'}">
        ${geoconten.filtrar()}
    </c:if>
    <c:if test="${param.co_filtro_eliminar != null && param.co_filtro_eliminar != ''}">
        ${geoconten.eliminarFiltro(param.co_filtro_eliminar)}
    </c:if>
    <c:if test="${param.co_filtro_editar != null && param.co_filtro_editar != ''}">
        ${geoconten.editarFiltro(param.co_filtro_editar)}
    </c:if>
    <c:if test="${param.terminar_edicion != null && param.terminar_edicion != ''}">
        ${geoconten.terminarEdicion()}
    </c:if>
    <c:if test="${param.portafolio != null && param.portafolio != '' && param.portafolio == 'true'}">
        <c:choose>
            <c:when test="${param.l_puntos_selec != null && param.l_puntos_selec != ''}">
                ${geoconten.crearPortafolio(param.l_puntos_selec)}
            </c:when>
            <c:otherwise>
                ${geoconten.crearPortafolio()}
            </c:otherwise>
        </c:choose>
        
    </c:if>
    <c:if test="${param.portafolio != null && param.portafolio != '' && param.portafolio == 'false'}">
        ${geoconten.eliminarPortafolio()}
    </c:if>
    <c:if test="${param.ocultar_vacios != null && param.ocultar_vacios != ''}">
        ${geoconten.setOcultarVacios(param.ocultar_vacios)}
    </c:if>
    
    <c:choose>
        <c:when test="${geoconten.portafolio != null}">
            <c:set var="escenario" value="${geoconten.portafolio}" scope="page"></c:set>
        </c:when>
        <c:otherwise>
            <c:set var="escenario" value="${geoconten.escenario_mostrar}" scope="page"></c:set>
        </c:otherwise>
    </c:choose>

    <c:if test="${param.co_filtro != null && param.co_filtro != ''}">
        ${escenario.cambiar_filtro(param.co_filtro)}
    </c:if>

    <c:if test="${param.ti_ordena != null && param.ti_ordena != ''}">
        ${escenario.ordenarAgrupamientos(param.ti_ordena,param.mo_ordena)}
    </c:if>
    


<div id="layer_control_1" style="border: 0px none; box-shadow: 1px 1px 2px #101;">
<c:choose>
    <c:when test="${geoconten.portafolio == null && fn:length(geoconten.l_escenarios)>1}">
        <c:forEach var="e" items="${geoconten.l_escenarios}" end="${fn:length(geoconten.l_escenarios)-1}">
            <c:if test="${e.filtro_selec.nu_geocap !=  escenario.filtro_selec.nu_geocap}">
                <div class="div_filtro_ant"><b>${e.filtro_selec.no_geocap}</b>&nbsp;&nbsp;&nbsp;(${fn:length(e.l_puntos_mostrados)}) puntos
                    <img src="${pageContext.request.contextPath}/img/gps/close.png" onclick="eliminar_filtro('${e.filtro_selec.nu_geocap}')" class="remove_filter" width="10px" title="Eliminar filtro">
                    <img src="${pageContext.request.contextPath}/img/gps/edit.png" onclick="editar_filtro('${e.filtro_selec.nu_geocap}')" class="remove_filter" width="10px" title="Editar filtro">
                    <br>
                    <a style="white-space: nowrap; text-decoration: none" title="<c:forEach var="a" items="${e.filtro_selec.l_agrupa}"><c:if test="${a.il_select}">${a.no_agrupa} - </c:if></c:forEach>">
                <c:forEach var="a" items="${e.filtro_selec.l_agrupa}">
                    <c:if test="${a.il_select}">
                        ${a.no_agrupa} - 
                    </c:if>
                </c:forEach>
                    </a>
                </div>
            </c:if>
            <c:if test="${e.filtro_selec.nu_geocap ==  escenario.filtro_selec.nu_geocap}">
                
                <c:set var="escenario" value="${escenario}" scope="request"></c:set>
                <c:set var="geoconten" value="${geoconten}" scope="request"></c:set>
                <jsp:include page="agrupamientos_include.jsp"></jsp:include>
                
            </c:if>
        </c:forEach>
    </c:when>
    <c:otherwise>
        
        <c:set var="escenario" value="${escenario}" scope="request"></c:set>
        <c:set var="geoconten" value="${geoconten}" scope="request"></c:set>
        <jsp:include page="agrupamientos_include.jsp"></jsp:include>
        
    </c:otherwise>
</c:choose>   
</div>
<div style="z-index: 1;">
    <table cellpadding="0" cellspacing="0" style="font-family: Arial,sans-serif; font-size: 13px;">
        <tr style="box-shadow: 1px 1px 2px #101;">
            <td style="width: 90%;">
                <div id="layer_control_tit" class="opt_left_tit">
                    <div style="height: 2px"></div>
                    CONTROLADOR
                </div>
            </td>
            <td style="width: 27px">
                <div id="show_layer" class="opt_left">
                    <img id="il_icoopt" onclick="option_control('layer_control_tit','layer_control_1','show_layer')" src="../img/gps/min_layer.png" draggable="false" style="padding: 0px; width: 25px; height: 25px; -moz-user-select: none;">
                </div>
            </td>
        </tr>
    </table>
</div>
